package back.mybatis.typehandle;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.StringTypeHandler;

import back.entity.User;

@MappedJdbcTypes(value = JdbcType.VARCHAR)
public class ToUser extends StringTypeHandler {

	@Override
	public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType)
			throws SQLException {
		// TODO Auto-generated method stub
		System.out.println("PreparedStatement:"+ps+","+"i:"+i+","+"parameter:"+parameter+","+"jdbcType:"+jdbcType);
		super.setNonNullParameter(ps, i, parameter, jdbcType);
	}

	@Override
	public String getNullableResult(ResultSet rs, String columnName) throws SQLException {
		// TODO Auto-generated method stub
		System.out.println("ResultSet:"+rs+","+"columnName:"+columnName);
		return super.getNullableResult(rs, columnName);
	}

	@Override
	public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
		// TODO Auto-generated method stub
		System.out.println("ResultSet:"+rs+","+"columnIndex:"+columnIndex);
		return super.getNullableResult(rs, columnIndex);
	}

	@Override
	public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
		// TODO Auto-generated method stub
		System.out.println("CallableStatement:"+cs+","+"columnIndex:"+columnIndex);
		return super.getNullableResult(cs, columnIndex);
	}

}
